package com.atguigu.yygh.sms.controller;

import com.atguigu.yygh.common.result.R;
import com.atguigu.yygh.sms.service.SMSService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/*==========================================
      时 间:   2022-03-11
      讲 师:   刘  辉
      描 述:   尚硅谷教学团队
 ==========================================*/
@RestController
@RequestMapping("/api/sms")
public class SMSController {

    @Autowired
   private  SMSService smsService;

    @GetMapping(value = "/send/{phone}")
    public R sendCode(@PathVariable String phone){
       boolean flag= smsService.sendCode(phone);
       if(flag){
           return R.ok();
       }else{
           return R.error();
       }
    }
}
